#ifndef _BSP_EQ_H
#define _BSP_EQ_H

#define little_endian_read_16(buf, ofs)         *(uint16_t *)((uint8_t *)buf + (ofs))
#define little_endian_read_32(buf, ofs)         *(uint32_t *)((uint8_t *)buf + (ofs))
#define EQ_BUFFER_LEN                           (260+10)

#if LOWHIGH_PASS_EN
#define LP_80Hz         1
#define LP_100Hz        2
#define LP_120Hz        3
#define LP_150Hz        4
#define LP_180Hz        5
#define LP_200Hz        6
#define LP_220Hz        7
#define LP_250Hz        8

#define HP_20Hz         1
#define HP_40Hz         2
#define HP_60Hz         3
#define HP_80Hz         4
#define HP_100Hz        5
#define HP_120Hz        6
#define HP_140Hz        7
#define HP_160Hz        8

#define SLOPE_12dB      1
#define SLOPE_24dB      2
#define SLOPE_30dB      3
#define SLOPE_48dB      4
#endif

#if EQ_MODE_EN
#define MUSIC_EQ_TBL_LEN                        6
#else
#define MUSIC_EQ_TBL_LEN                        1
#endif // EQ_MODE_EN

typedef struct {
    u32 *addr;
    u32 *len;
} eq_param;

typedef struct  {
    u8 remain   :   1;      //spp拼包标志
    u16 remian_ptr;         //拼包长度
    u16 rx_size;            //拼包长度
}eq_spp_cb_t;

typedef struct {
    u8 type;
    u8 rx_type;
    u8 xdrc_res;
    eq_spp_cb_t eq_spp_cb;
}eq_dbg_cb_t;

extern eq_dbg_cb_t eq_dbg_cb;

void sys_set_eq(void);
void eq_parse_cmd(void);
void eq_dbg_init(void);

void bsp_eq_init(void);
void mic_bass_treble_set(int mode, int gain);   //mode: 0(bass), 1(treble)
void music_bass_treble_set(int mode, int gain);
void music_bass_eq_set_customer(int gain,u8 freq);
void music_set_eq_for_index(u8 index, int gain);
void music_set_eq_dual_for_index(u8 lr,u8 index, int gain);

extern void digital_vol_set_before_eq(u16 vol, int*music_coef);  //BASS_TRE数字音量设置,不支持EQ.
extern int music_coef[];

//AUCAR_EQ_LOUD_BASS_TREBLE_EN 使能时调用的API函数.
void aucar_music_loud_set(int gain);    //gain取值范围[-12,+12]
void aucar_music_bass_set(int gain);    //gain取值范围[-12,+12]
void aucar_music_treble_set(int gain);     //gain取值范围[-12,+12]
void digital_vol_set_for_aucar(u32 dig_vol);   //车机数字音量在EQ前设置.

enum {
    EQ_BASS = 0,   //低音调节
    EQ_TREB = 1,    //高音调试
};
#endif
